﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Rabbit.Contracts.Interface;
using Rabbit.Domain.Entity;

namespace Rabbit.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MachinController : ControllerBase
    {
        private readonly IMachinService _machinService;
        private readonly ILogger<MachinController> _logger;

        public MachinController(IMachinService machinService, ILogger<MachinController> logger)
        {
            _machinService = machinService;
            _logger = logger;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="Machin"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GeMachinAdd(Machining Machin)
        {
            var list=_machinService.GeMachinAdd(Machin);
            return Ok(list);
        }

        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetMachinFind(int id)
        {
           var list=_machinService.GetMachinFind(id);
            return Ok(list);
        }

        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetMachinShow(int id)
        {
           var list=_machinService.GetMachinShow(id);
            return Ok(list);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="Machin"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetMachinUpd(Machining Machin)
        {
            var list=_machinService.GetMachinUpd(Machin);
            return Ok(list);
        }

        /// <summary>
        /// 供应商显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult  GetGongyingshangShow()
        {
           var list=_machinService.GetGongyingshangShow();
            return Ok(list);
        }


        /// <summary>
        /// 深加工公司显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetMachiningenterpriseShow()
        {
            var list=_machinService.GetMachiningenterpriseShow();
            return Ok(list);
        }

        /// <summary>
        /// 深加工公司修改
        /// </summary>
        /// <param name="Machin"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetGongyingshangXiu(Machiningenterprise Machin)
        {
            var list = _machinService.GetGongyingshangXiu(Machin);
            return Ok(list);
        }
    }
}
